/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package almacen.bean;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author Antonio
 */
@Entity
@Table(name = "producto_tipo", catalog = "bd_almacen", schema = "public")
@NamedQueries({
    @NamedQuery(name = "ProductoTipo.findAll", query = "SELECT p FROM ProductoTipo p"),
    @NamedQuery(name = "ProductoTipo.findByTppCodigo", query = "SELECT p FROM ProductoTipo p WHERE p.tppCodigo = :tppCodigo"),
    @NamedQuery(name = "ProductoTipo.findByTppDescripcion", query = "SELECT p FROM ProductoTipo p WHERE p.tppDescripcion = :tppDescripcion")})
public class ProductoTipo implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy= GenerationType.SEQUENCE)
    @Column(name = "tpp_codigo")
    private Integer tppCodigo;
    @Column(name = "tpp_descripcion")
    private String tppDescripcion;

    public ProductoTipo() {
    }

    public ProductoTipo(Integer tppCodigo) {
        this.tppCodigo = tppCodigo;
    }

    public Integer getTppCodigo() {
        return tppCodigo;
    }

    public void setTppCodigo(Integer tppCodigo) {
        Integer oldTppCodigo = this.tppCodigo;
        this.tppCodigo = tppCodigo;
        changeSupport.firePropertyChange("tppCodigo", oldTppCodigo, tppCodigo);
    }

    public String getTppDescripcion() {
        return tppDescripcion;
    }

    public void setTppDescripcion(String tppDescripcion) {
        String oldTppDescripcion = this.tppDescripcion;
        this.tppDescripcion = tppDescripcion;
        changeSupport.firePropertyChange("tppDescripcion", oldTppDescripcion, tppDescripcion);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tppCodigo != null ? tppCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProductoTipo)) {
            return false;
        }
        ProductoTipo other = (ProductoTipo) object;
        if ((this.tppCodigo == null && other.tppCodigo != null) || (this.tppCodigo != null && !this.tppCodigo.equals(other.tppCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "almacen.view.ProductoTipo[ tppCodigo=" + tppCodigo + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
